package com.boco.raptor.subsystem.attempx.dto;

import java.util.*;

import com.boco.transnms.common.bussiness.consts.*;

public class AttempSheetStatForm{
    private String districtCuid = "";
    private String districtName = "";
    private int sheetNum = 0;
    private ArrayList<AttempSheetStatSubPerson> personArrayList = new ArrayList();
    private ArrayList attempSheetList = new ArrayList();
    private ArrayList attempSheetCuidsList = new ArrayList();
    private long rowNum = 0;
    public String getDistrictCuid() {
        return districtCuid;
    }  
    public void setAttempSheetStatSubPersonCount(String personCuid,long attempType,String sheetCuid){
       for(int i=0;i<personArrayList.size();i++){
          AttempSheetStatSubPerson attempSheetStatSubPerson = personArrayList.get(i);
          if(attempSheetStatSubPerson.getPersonCuid().equals(personCuid)){
              if(attempType==WorkflowEnum.ATTEMP_TYPE_CH._add){
                  attempSheetStatSubPerson.addPersonAddNum(1);
              }else if(attempType==WorkflowEnum.ATTEMP_TYPE_CH._adjust){
                  attempSheetStatSubPerson.addPersonModifyNum(1);
              }else{
                 attempSheetStatSubPerson.addPersonCloseNum(1);
              }
              break;
          }
       }
    }
    public void setAttempSheetStatSubPersonName(HashMap personMap){
        for(int i=0;i<personArrayList.size();i++){
            AttempSheetStatSubPerson attempSheetStatSubPerson = personArrayList.get(i);
            String personName = (String)personMap.get(attempSheetStatSubPerson.getPersonCuid());
            attempSheetStatSubPerson.setPersonName(personName);
        }
        rowNum = personArrayList.size();
    }
    public void setAttempSheetStatSubPerson(String personCuid,boolean isValidSheet){
       boolean flag = false;
       for(int i=0;i<this.personArrayList.size();i++){
          AttempSheetStatSubPerson attempSheetSubPerson = (AttempSheetStatSubPerson)personArrayList.get(i);
          if(attempSheetSubPerson.getPersonCuid().equals(personCuid)){
              if(isValidSheet){
                  attempSheetSubPerson.attSheetNum(1);
              }
              flag = true;
              break;
          }
       }
       if(!flag){
           AttempSheetStatSubPerson attempSheetSubPerson2 = new AttempSheetStatSubPerson();
           attempSheetSubPerson2.setPersonCuid(personCuid);
           if(isValidSheet){
               attempSheetSubPerson2.attSheetNum(1);
           }
           this.personArrayList.add(attempSheetSubPerson2);
       }
    }
    public void setAttempSheetCuid(String attSheetCuid){
       if(!this.attempSheetCuidsList.contains(attSheetCuid)){
           this.attempSheetCuidsList.add(attSheetCuid);
       }
    }
    public ArrayList getAttempSheetCuidsList(){
       return this.attempSheetCuidsList;
    }
    public void addSheetNum(int num){
        this.sheetNum += num;
    }

    public String getDistrictName() {
        return districtName;
    }

    public int getSheetNum() {
        return sheetNum;
    }

    public ArrayList getPersonArrayList() {
        return personArrayList;
    }

    public ArrayList getAttempSheetList() {
        return attempSheetList;
    }

    public long getRowNum() {
        return rowNum;
    }

    public void setDistrictCuid(String districtCuid) {
        this.districtCuid = districtCuid;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    public void setSheetNum(int sheetNum) {
        this.sheetNum = sheetNum;
    }

    public void setPersonArrayList(ArrayList personArrayList) {
        this.personArrayList = personArrayList;
    }

    public void setAttempSheet(ArrayList attempSheet) {
        if(this.attempSheetList==null){
           this.attempSheetList = new ArrayList();
        }
        this.attempSheetList.add(attempSheet);
    }

}
